package com.lyw.springCloud.service;

import com.lyw.springCloud.entities.Payment;
import com.lyw.springCloud.result.CommonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@Component
// 找哪个微服务
@FeignClient(value = "CLOUD-PAYMENT-SERVICE") // 使用 feign
public interface PaymentFeignService {

    // 这个微服务中的这个地址
    @GetMapping("/payment/get/{id}") // 这个服务中的 CLOUD-PAYMENT-SERVICE 这个地址 /payment/get/{id}
    public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id);

    @GetMapping("/payment/feign/timeout")
    public String timeout() throws InterruptedException;
}
